package com.train.mgr.modules.biz.controller;

import com.train.common.model.PageParam;
import com.train.common.model.PageResult;
import com.train.common.model.R;
import com.train.mgr.modules.biz.entity.LessonUserReview;
import com.train.mgr.modules.biz.service.ILessonUserReviewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * 用户课时复习表 前端控制器
 * @author cxg
 * @date 2025-09-30
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@Api( tags = "用户课时复习")
@ApiIgnore
@RequestMapping("/lessonUserReview")
public class LessonUserReviewController {

    private final ILessonUserReviewService lessonUserReviewService;

    /**
     * 功能描述:单个获取 (仅作参考)
     * @author: cxg
     * @date: 2025-09-30
     */
    @GetMapping("/getById/{id}")
    @ApiOperation("查询详情")
    public R<LessonUserReview> getById(@PathVariable(name = "id") Long id) {
        LessonUserReview lessonUserReview = lessonUserReviewService.getById(id);
        return R.succeed(lessonUserReview);
    }


    /**
     * 条件 分页查询 (仅作参考)
     * @author: cxg
     * @date: 2025-09-30
     */
    @GetMapping("/page")
    @ApiOperation("分页查询用户列表")
    public R<PageResult<LessonUserReview>> page(PageParam params) {
        PageResult<LessonUserReview> iPage = null; //lessonUserReviewService.page(params);
        return R.succeed(iPage);
    }

    /**
	 * 新增 (仅作参考)
     * @author: cxg
     * @date: 2025-09-30
	 */
    @PostMapping
    @ApiOperation("新增XXX")
    public R<Boolean> add(@RequestBody @Validated LessonUserReview body) {
        Boolean result = lessonUserReviewService.save(body);
        return R.succeed(result);
    }

	/**
	 * 更新 (仅作参考)
     * @author: cxg
     * @date: 2025-09-30
	 */
    @PatchMapping
    @ApiOperation("更新XXX")
    public R<Boolean> update(@RequestBody @Validated LessonUserReview body) {
        Boolean result = lessonUserReviewService.updateById(body);
        return R.succeed(result);
    }

	/**
	 * 删除 (仅作参考)
     * @author: cxg
     * @date: 2025-09-30
	 */
    @DeleteMapping
    @ApiOperation("删除XXX")
    public R<Boolean> delete(@RequestParam(name = "ids") List<Long> ids) {
          Boolean result = lessonUserReviewService.removeByIds(ids);
          return R.succeed(result);
    }
}
